Skip to content

Conversation

@staskus
Copy link
Contributor

@staskus staskus commented Aug 7, 2025

WOOMOB-1009

Description

When the Woo app is initially launched and user logs in, Orders and Products tab are not displayed in a split view. The app needs to be killed and relaunched for a split view to appeared.

The iPadOS 18 + Xcode 16 hack was not working properly on first launch after login because it requires view.window to be available to access the window's trait collection. It turns all the views into .compact, not just the tab bar itself.

During initial login flow:

  1. viewDidLoad() is called before tab controller is added to window hierarchy
  2. AppCoordinator.displayLoggedInUI() sets tab controller as window root
  3. view.window becomes available, but fixTabBarTraitCollectionOnIpadForiOS18 was already called when window was nil

Wrong solution

Calling fixTabBarTraitCollectionOnIpadForiOS18 on viewDidAppear was a bad choice (implemented in #15985 and reverted in #15988). The fix worked with the first login, but would make tabs appear correctly after a delay during the subsequent launch, also sometimes causing crashes when opening Order and Product tabs.

Better solution

There are two issues that need to be fixed with the original fixTabBarTraitCollectionOnIpadForiOS18 solution:

  • window is not yet accessible to get an overall traitCollection collection if the viewController is not added in the view hierarchy
  • tabs are not yet loaded

To solve those issues we can do two things:

  • window is not yet accessible on a view but can be accessed through AppDelegate.shared.window, since the window it self is loaded.
  • Call fixTabBarTraitCollectionOnIpadForiOS18 after tabs are loaded (fixTabBarTraitCollectionOnIpadForiOS18)

Steps to reproduce

First Launch

  1. Remove the app
  2. Install the app on the iPad
  3. Login
  4. Open Orders or Products tab
  5. Confirm they appear in the split view

Subsequent Launches

  1. Kill and relaunch the app
  2. Open Orders or Products tab
  3. Confirm they appear in the split view

Testing information

On iPad Air 18.5 simulator and iPad Air M2 26. device:

  • Tested first and subsequent launches
  • Tested logging out and logging in
  • Tested self-hosted and Dotcom login paths
  • Tested system split views, tested changing window sizes with iPadOS 26, tested changing orientations

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@staskus staskus added this to the 23.0 milestone Aug 7, 2025
@staskus staskus requested a review from joshheald August 7, 2025 09:32
@dangermattic
Copy link
Collaborator

1 Warning
⚠️ This PR is assigned to the milestone 23.0. This milestone is due in less than 2 days.
Please make sure to get it merged by then or assign it to a milestone with a later deadline.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

App Icon📲 You can test the changes from this Pull Request in WooCommerce iOS Prototype by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS Prototype
Build Numberpr15989-4a5fe3d
Version22.9
Bundle IDcom.automattic.alpha.woocommerce
Commit4a5fe3d
Installation URL6npmvvv7n2v7o
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

Copy link
Contributor

@joshheald joshheald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, works well – I couldn't repro on my iOS 17 iPad even before this, so did so on a simulator. With this, I can't break it any more.

@staskus staskus merged commit 7d717e9 into trunk Aug 7, 2025
21 of 23 checks passed
@staskus staskus deleted the woomob-1009-ipad-split-view-is-not-working-on-orders-and-products-tabs-2 branch August 7, 2025 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants